﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:local="clr-namespace:Imagin.Controls.Common">
    <Style TargetType="{x:Type local:Link}">
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="Cursor" Value="Hand" />
        <Setter Property="ToolTip" Value="{Binding Uri, RelativeSource={RelativeSource Self}}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:Link">
                    <Border 
                        Background="{TemplateBinding Background}" 
                        BorderBrush="{TemplateBinding BorderBrush}" 
                        BorderThickness="{TemplateBinding BorderThickness}" 
                        Padding="{TemplateBinding Padding}" 
                        VerticalAlignment="{TemplateBinding VerticalAlignment}" 
                        HorizontalAlignment="{TemplateBinding HorizontalAlignment}">
                        <TextBlock 
                            Foreground="{TemplateBinding Foreground}" 
                            FontFamily="{TemplateBinding FontFamily}" 
                            FontSize="{TemplateBinding FontSize}" 
                            FontStretch="{TemplateBinding FontStretch}" 
                            FontStyle="{TemplateBinding FontStyle}" 
                            FontWeight="{TemplateBinding FontWeight}"
                            Text="{TemplateBinding Content}"
                            TextDecorations="{TemplateBinding TextDecorations}"
                            TextTrimming="{TemplateBinding TextTrimming}"
                            TextWrapping="{TemplateBinding TextWrapping}"/>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="TextDecorations" Value="Underline" />
                <Setter Property="Background" Value="Transparent"/>
            </Trigger>
            <Trigger Property="IsPressed" Value="True">
                <Setter Property="TextDecorations" Value="Underline" />
                <Setter Property="Background" Value="Transparent"/>
            </Trigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsMouseOver" Value="False"/>
                    <Condition Property="IsPressed" Value="False"/>
                </MultiTrigger.Conditions>
                <Setter Property="TextDecorations" Value="None" />
                <Setter Property="Background" Value="Transparent"/>
            </MultiTrigger>
        </Style.Triggers>
    </Style>
</ResourceDictionary>